<template>
	<view class="paySuccess">
		<view class="top">
			<image src="../../static/images/user/icon_success@2x.png" class="image"></image>
			<text class="text">支付成功</text>
		</view>
		<view class="list" v-if="orderDetail">
			<view class="item">
				<view class="item-left">支付方式</view>
				<view class="item-right">{{orderDetail.memo}}</view>
			</view>
			<view class="item">
				<view class="item-left">订单号</view>
				<view class="item-right">{{orderDetail.orderid}}</view>
			</view>
			<view class="item">
				<view class="item-left">门店名称</view>
				<view class="item-right">{{orderDetail.ground.name}}</view>
			</view>
		</view>
		<view class="lookOrder">
			<view @click="gotoOrder" class="button">查看订单</view>
		</view>
	</view>
</template>

<script>
	import api from '@/api/index.js';
	export default {
		data() {
			return {
				order_id: null, //订单id
				orderDetail: null, //订单信息
			}
		},
		onLoad(options) {
			if(options&&options.order_id){
				this.order_id = options.order_id
				this.getOrderDetail()
			}
		},
		methods: {
			getOrderDetail(){
				api.getOrderDetail({
					orderid:this.order_id
				}).then(res => {
					this.orderDetail = res.data;
				});
			},
			gotoOrder() {
				uni.redirectTo({
					url: '/pages/user/orderList' // 跳转到对应路径的页面
				});
			},
		}
	}
</script>

<style lang="scss">
	.paySuccess {
		background: #F8F8F8;
		padding: 0 36rpx;
		height: 100vh;

		.top {
			text-align: center;

			.image {
				width: 106rpx;
				height: 106rpx;
				margin: 100rpx auto 40rpx;
			}

			.text {
				font-family: PingFangSC, PingFang SC;
				font-weight: 550;
				font-size: 40rpx;
				color: #000000;
				line-height: 56rpx;
				font-style: normal;
				display: block;
				margin-bottom: 60rpx;
			}
		}

		.list {
			background: #FFFFFF;
			border-radius: 28rpx;
			padding: 0 40rpx;

			.item {
				line-height: 90rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				border-bottom: 2rpx solid #F0F0F0;

				&:last-child {
					border-bottom: none;
				}

				.item-left {
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #000000;
				}

				.item-right {
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #000000;
				}
			}
		}

		.lookOrder {
			margin-top: 200rpx;

			.button {
				width: 330rpx;
				height: 88rpx;
				border-radius: 100rpx;
				border: 1rpx solid #E6E5E5;
				line-height: 88rpx;
				text-align: center;
				    margin: 0 auto;
			}
		}
	}
</style>